package com.muyu.system.controller;


import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.poi.ExcelUtil;
import com.muyu.common.core.web.controller.BaseController;
import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.common.log.annotation.Log;
import com.muyu.common.log.enums.BusinessType;
import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.system.domain.DanmoShoppingPaymentMethods;
import com.muyu.system.service.IDanmoShoppingPaymentMethodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 支付方式Controller
 * 
 * @author kunzong
 * @date 2024-12-16
 */
@RestController
@RequestMapping("/DanmoShoppingPaymentMethods")
public class DanmoShoppingPaymentMethodsController extends BaseController
{
    @Autowired
    private IDanmoShoppingPaymentMethodsService danmoShoppingPaymentMethodsService;

    /**
     * 查询支付方式列表
     */
//    @RequiresPermissions("system:DanmoShoppingPaymentMethods:list")
    @GetMapping("/list")
    public Result list(DanmoShoppingPaymentMethods danmoShoppingPaymentMethods)
    {
        startPage();
        List<DanmoShoppingPaymentMethods> list = danmoShoppingPaymentMethodsService.selectDanmoShoppingPaymentMethodsList(danmoShoppingPaymentMethods);
        return Result.success(list);
    }

    /**
     * 导出支付方式列表
     */
//    @RequiresPermissions("system:DanmoShoppingPaymentMethods:export")
    @Log(title = "支付方式", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DanmoShoppingPaymentMethods danmoShoppingPaymentMethods)
    {
        List<DanmoShoppingPaymentMethods> list = danmoShoppingPaymentMethodsService.selectDanmoShoppingPaymentMethodsList(danmoShoppingPaymentMethods);
        ExcelUtil<DanmoShoppingPaymentMethods> util = new ExcelUtil<DanmoShoppingPaymentMethods>(DanmoShoppingPaymentMethods.class);
        util.exportExcel(response, list, "支付方式数据");
    }

    /**
     * 获取支付方式详细信息
     */
//    @RequiresPermissions("system:DanmoShoppingPaymentMethods:query")
    @GetMapping(value = "/{id}")
    public Result getInfo(@PathVariable("id") Long id)
    {
        return Result.success(danmoShoppingPaymentMethodsService.selectDanmoShoppingPaymentMethodsById(id));
    }

    /**
     * 新增支付方式
     */
//    @RequiresPermissions("system:DanmoShoppingPaymentMethods:add")
    @Log(title = "支付方式", businessType = BusinessType.INSERT)
    @PostMapping
    public Result add(@RequestBody DanmoShoppingPaymentMethods danmoShoppingPaymentMethods)
    {
        return Result.success(danmoShoppingPaymentMethodsService.insertDanmoShoppingPaymentMethods(danmoShoppingPaymentMethods));
    }

    /**
     * 修改支付方式
     */
//    @RequiresPermissions("system:DanmoShoppingPaymentMethods:edit")
    @Log(title = "支付方式", businessType = BusinessType.UPDATE)
    @PutMapping
    public Result edit(@RequestBody DanmoShoppingPaymentMethods danmoShoppingPaymentMethods)
    {
        return Result.success(danmoShoppingPaymentMethodsService.updateDanmoShoppingPaymentMethods(danmoShoppingPaymentMethods));
    }

    /**
     * 删除支付方式
     */
//    @RequiresPermissions("system:DanmoShoppingPaymentMethods:remove")
    @Log(title = "支付方式", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public Result remove(@PathVariable Long[] ids)
    {
        return Result.success(danmoShoppingPaymentMethodsService.deleteDanmoShoppingPaymentMethodsByIds(ids));
    }
}
